package com.hoas.quickstart.threads.chapter03.chapter03_2_5;

public class ThreadA extends Thread{

    private ThreadB b;

    public ThreadA(ThreadB b) {
        this.b = b;
    }

    @Override
    public void run() {
        try {
            synchronized (b) {
                b.start();
//                Thread.sleep(6000); //不会释放锁
                b.join();
                for (int i = 0; i < Integer.MAX_VALUE; i++) {
                    String newString = new String();
                    Math.random();
                }
            }

        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
